from django.db import models
from django.utils import timezone

# Create your models here.

class Student(models.Model):
    Name = models.CharField(max_length=20)
    Code = models.IntegerField(default=201800001)
    College = models.CharField(max_length=20)
    Class = models.CharField(max_length=20)
    QQ = models.IntegerField(default=1234567890)
    Tel = models.IntegerField(default=17300000000)
    Self = models.CharField(max_length=200,blank=True)
    Regtime = models.DateField(default=timezone.now,blank=True,null=True)
    Birthday = models.DateField(blank=True,null=True)
    Photo = models.ImageField(upload_to='images',blank=True)
    Apply = models.BooleanField(default=False)
    Admit = models.BooleanField(default=False)

    def __str__(self):
        return self.Name
    class Meta:
        verbose_name_plural = 'StudentsList'

class Score(models.Model):
    Names = models.OneToOneField(Student,on_delete = models.CASCADE)
    Pentest = models.CharField(max_length=15,default='notdefined')
    Outer = models.IntegerField(default=0,blank=True,null=True)
    Inner = models.IntegerField(default=0,blank=True,null=True)
    Interest = models.IntegerField(default=0,blank=True,null=True)
    Want = models.IntegerField(default=0,blank=True,null=True)
    Sum = models.IntegerField(default=0,blank=True,null=True)

    def __str__(self):
        return self.Names.Name

    class Meta:
        verbose_name_plural = 'ScoresList'
